#Include Once "windows.bi"
#Include Once "gui_chung_dll.bi"

Sub notice(ByRef msg As string,ByRef title As String ="notice")
Dim As HWND hwin
ScreenControl(2, Cast(Integer,hwin)) 'get screen handle
	messagebox(hwin,msg,title,MB_TASKMODAL Or 0)
   Sleep 200
End Sub

Dim Shared As Integer quit
Sub subquit()
	quit=1
End Sub
Sub subcombo()
	Dim As Integer i
	getcomboindex(@"win.combo",@i)
	notice Str(i)+" "+*guicurrentcontrolname()
End Sub
Sub subbutton()
guidrawcolor(Int(Rnd*255),Int(Rnd*255),Int(Rnd*255),255)
guidrawbackcolor(Int(Rnd*150),Int(Rnd*150),Int(Rnd*150),255)
guidrawbox(@"win.graph",1,1,Int(Rnd*300),Int(Rnd*250),Int(Rnd*2))
guidrawstring(@"win.graph",100,100,"this is a test")	
guirefreshwindow(@"win")
End Sub

'notice "ok"
combobox(@"win.combo",@subcombo(),20,20,100,100)
button(@"win.button","draw",@subbutton,170,15,45,25)
graphicbox(@"win.graph",20,50,300,250)
openwindow(@"win",@"mywindow",100,10,340,340)

trapclose(@"win",@subquit())
addcombo(@"win.combo",@"item1")
Dim As zstringptr liste(100)
Dim As ZStringptr Ptr pliste=@liste(0)
liste(0)=@"liste0"
liste(1)=@"liste1"
liste(2)=@"liste2"
pliste[0]=@"pliste0"
'pliste[1]=@"pliste1"
pliste[2]=@"pliste2"
pliste[3]=0
'notice Str(*pliste[2]+" "+*liste(2))
reloadcombo(@"win.combo",@pliste[0])

While quit=0 And guitestkey(vk_escape)=0
	guiscan
	Sleep 100
Wend
guiclosewindow(@"win")
guiclose()
guiquit()

End 